package demo.activity.base;

import java.util.ArrayList;

import sample.xutils.BitmapUtilsActivity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import demo.activity.AdAct;
import demo.activity.AnimationDemo;
import demo.activity.ChattingActivity;
import demo.activity.DataSelectActivity;
import demo.activity.DialogDemo;
import demo.activity.DownLoadFile;
import demo.activity.FloatViewActivity;
import demo.activity.FontTypeDIY;
import demo.activity.ImageShareDemo;
import demo.activity.ImageViewCircleDemo;
import demo.activity.ListViewEmptyActivity;
import demo.activity.MyViewDemo;
import demo.activity.NotifycationDemo;
import demo.activity.PhotoAlbumActivity;
import demo.activity.ProgressDemo;
import demo.activity.ProgressLayoutDemo;
import demo.activity.ShapeDemo;
import demo.activity.SpannableStringDemo;
import demo.activity.TextArrangeDemo;
import demo.activity.VideoFindDemo;
import demo.activity.ZTestActivity;
import demo.activity.test.MyListDemo;
import demo.adapter.StringAdapter;
import demo.zandroid.R;

public class MainActivity extends Activity implements View.OnClickListener {

	private Class<?>[] classes = new Class<?>[] { 
			DialogDemo.class,
			ShapeDemo.class,
			SpannableStringDemo.class,
			ImageShareDemo.class,
			NotifycationDemo.class,
			PhotoAlbumActivity.class,
			FloatViewActivity.class,
			ZTestActivity.class,
			DataSelectActivity.class,
			AnimationDemo.class,
			MyListDemo.class,
			TextArrangeDemo.class,
			ChattingActivity.class,
			BitmapUtilsActivity.class,
			ListViewEmptyActivity.class,
			ImageViewCircleDemo.class,
			MyViewDemo.class,
			FontTypeDIY.class,
			VideoFindDemo.class,
			ProgressDemo.class,
			ProgressLayoutDemo.class,
			AdAct.class,
			DownLoadFile.class,
			};

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		ListView list_main = (ListView) findViewById(R.id.list_main);
		ArrayList<String> classNames = new ArrayList<String>();
		for (int i = 0; i < classes.length; i++) {
			classNames.add(classes[i].getSimpleName());
		}
		list_main.setAdapter(new StringAdapter(this, classNames));
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case android.R.id.text1:
			int position = (Integer) v.getTag(R.string.app_name);
			startActivity(new Intent(MainActivity.this, classes[position]));
			break;
		default:
			break;
		}
		
	}

}

